﻿using mds.ConfigurationService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mds.ConfigurationClient
{
    public class ConfigurationClient:IConfigurationClient
    {

        private static ConfigurationClient _instance = new ConfigurationClient();

        public static ConfigurationClient Instance
        {
            get { return _instance; }
           
        }
        public SoulationContainer GetNewConfig(Guid soluationId, Guid appId)
        {
            RemoteConfigureServiceProviderClient client = new RemoteConfigureServiceProviderClient();
            var r=client.GetNewSoulation(soluationId, appId);
            client.Close();
            if (r.ActionResult) return r.Data;
            return null;
        }

        public SoulationContainer GetConfig(Guid soluationId, Guid appId, int soluationVersion)
        {
            RemoteConfigureServiceProviderClient client = new RemoteConfigureServiceProviderClient();
            var r = client.GetSoulation(soluationId, appId,soluationVersion);
            client.Close();
            if (r.ActionResult) return r.Data;
            return null;
        }
    }
}
